/*
 * Copyright (C) 2019-2020 Alibaba Group Holding Limited
 */

#ifndef _ALERTOR_SERVER_H_
#define _ALERTOR_SERVER_H_

#include <stdint.h>

typedef enum {
    ALERTOR_ST_IDLE = 0,
    ALERTOR_ST_WORKING,
    ALERTOR_ST_ACK,
    ALERTOR_ST_DISCONNECT,
} alertor_state_en;

typedef enum {
    ALERTOR_SHEFANG = 0x01,
    ALERTOR_UNLOCK = 0x02,
    ALERTOR_FIND = 0x03,
    ALERTOR_START = 0x04,
} alertor_cmd0_param;

typedef enum {
    ALERTOR_SEAT_LOCK = 0x00,
    ALERTOR_SEAT_UNLOCK = 0x01,
} alertor_seat_lock_param;

typedef enum {
    ALERTOR_MUTE_ON = 0x00,
    ALERTOR_MUTE_OFF = 0x01,
} alertor_mute_param;

typedef enum {
    ALERTOR_CMD0 = 0x00,
    ALERTOR_CMD_SEN_SET = 0x03,
    ALERTOR_CMD_DATA_ACK = 0x05,
    ALERTOR_CMD_SEAT_LOCK = 0x06,
    ALERTOR_CMD_MUTE_CTRL = 0x07,
} alertor_cmd_e;

#pragma pack(1)
typedef struct _alertor_ble_data {
    uint8_t head;
    uint8_t cmd;
    uint8_t param;
} alertor_ble_data_t;
#pragma pack()

typedef void (*alertor_event_callback_t)(alertor_state_en state);

int ble_alertor_init(alertor_event_callback_t cb);

void ble_alertor_process();

#endif /* _ALERTOR_SERVER_H_ */
